package xdu.lz.beanlife;

import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;

/**
 * @date 2020/5/24 21:51
 */
public class Main {



	@Test
	public void test1() throws Exception{
		ApplicationContext context
				= new AnnotationConfigApplicationContext(MyConfig.class);
		System.out.println(context.getBean(User.class));
		//手动关闭bean容器，在执行invoke之前会执行myDestroy
		context.getClass().getMethod("close").invoke(context);
	}

	public static void main(String[] args) throws Exception {
		ApplicationContext context
				= new AnnotationConfigApplicationContext(MyConfig.class);
		System.out.println(context.getBean(User.class));
		//手动关闭bean容器，在执行invoke之前会执行myDestroy
		context.getClass().getMethod("close").invoke(context);
	}





}
